<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Model\Admin\Navs;
use Illuminate\Support\Facades\View;
use App\Model\Admin\Article;
use App\Model\Admin\Links;
use App\Model\Admin\Category;

class CommonController extends Controller
{
    //
	public function __construct(){
		$navs = Navs::all();

		//八篇最新的文章
		$new = Article::orderBy('art_time','desc')->take(8)->get();

		//五篇点击量最高的文章
		$hot = Article::orderBy('art_view','desc')->take(5)->get();

		//友情链接
		$links = Links::orderBy('link_order','asc')->get();

		View::share([
			'navs'=>$navs,
			'new'=>$new,
			'hot'=>$hot,
			'links'=>$links,
			]);
	}
}
